<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" >

	<head>
		<meta charset="utf-8">
		<title>系统管理-讲师列表</title>
		<link href="../c/base.css" rel="stylesheet" type="text/css">
		<link href="../c/toefl.css" rel="stylesheet" type="text/css">
		<link href="../c/bootstrap.min.css" rel="stylesheet" type="text/css">
		<script type="text/javascript" src="../j/jquery-2.1.0.js"></script>
		<script type="text/javascript" src="../j/bootstrap.min.js"></script>
		<script type="text/javascript" src="../j/lrtk.js"></script>
		<link href="../js/ligerUI/skins/Aqua/css/ligerui-dialog.css" rel="stylesheet" type="text/css" />  
		<script src="../js/ligerUI/js/core/base.js" type="text/javascript"></script>
		<script src="../js/ligerUI/js/plugins/ligerDialog.js" type="text/javascript"></script>
		<script src="../js/ligerUI/js/plugins/ligerDrag.js" type="text/javascript"></script>
		<script src="../js/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
		<script type="text/javascript" th:inline="none">
		 $(function(){
		    	var boxs = $("input[type='checkbox'][id^='box_']");
		    	
		    	
		    	$("tr[id^='data_']").hover(function(){
		    		$(this).css("backgroundColor","#eeccff");
		    	},function(){
		    		$(this).css("backgroundColor","#ffffff");
		    	})
		    	
		    	$("#checkAll").click(function() {
					boxs.prop("checked", this.checked);
				})
		    	
		 	   $("#delete").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要删除的文章！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要删除吗?","删除文章",function(r){
		 				   if(r){
		 					  window.location = "delArticles?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#ban").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要禁读的文章！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要禁读吗?","禁读文章",function(r){
		 				   if(r){
		 					  window.location = "banArticles?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		 	   
		 	   $("#unlash").click(function(){
		 		   /** 获取到用户选中的复选框  */
		 		   var checkedBoxs = boxs.filter(":checked");
		 		   if(checkedBoxs.length < 1){
		 			   $.ligerDialog.error("请选择一个需要解除的文章！");
		 		   }else{
		 			   var ids = checkedBoxs.map(function(){
		 				   return this.value;
		 			   })
		 			   
		 			   $.ligerDialog.confirm("确认要解除吗?","解除文章",function(r){
		 				   if(r){
		 					  window.location = "unlashArticles?ids=" + ids.get();
		 				   }
		 			   });
		 		   }
		 	   })
		    })
		    function schArticle(pageNum){
			 $("#pageNum").val(pageNum);
			 $("#schArticleForm").submit();
		 }
	</script>
	<style>
		.nowPage {
			color: red;
		}
	</style>
	</head>

	<body>
		<div class="openMenu">
			<div class="doc1180">
		    	<ul class="fn-clear" style="padding-left:220px;">
		        	<li class="openMenuOn"><a href="toToeflAdmin">全部</a></li>
		            <li><a href="article_class?activity_type=1">听力</a></li>
		            <li><a href="article_class?activity_type=2">口语</a></li>
		            <li><a href="article_class?activity_type=3">阅读</a></li>
		            <li><a href="article_class?activity_type=4">写作</a></li>
		            <li><a href="article_class?activity_type=5">词汇</a></li>
		            <li><a href="article_class?activity_type=6">咨询</a></li>
		            <li><a href="article_class?activity_type=7">活动</a></li>
		            <li><a href="article_class?activity_type=8">机经</a></li>
		        </ul>
		    </div>
		</div>
		<div class="doc1180 paddingT20 fn-clear container">
			<div>
				<form class="form-inline" action="toToeflAdmin" method="post" id="schArticleForm">
					<div class="form-group">
						<label for="exampleInputName2">标题</label>
						<input type="text" class="form-control" id="exampleInputName2" name="title" th:value="${session.schArticle.title}">
					</div>
					<div class="form-group">
						<label for="exampleInputEmail2">发布讲师</label>
						<select class="form-control" name="publish_teacher">
							<option value="">请选择讲师</option>
							<option  th:each="l:${session.teacherList}" th:value="${l.teacher_id}"th:selected="${session.schArticle.publish_teacher}==${l.teacher_id}">[[${l.user_name}]]</option>
						</select>
					</div>
					<div class="form-group">
						<label for="exampleInputEmail2">课程类别</label>
						<select class="form-control" name="article_type">
							<option value="">请选择类别</option>
							<option  th:each="a:${session.articleType}" th:value="${a.type_id}" th:selected="${session.schArticle.article_type}==${a.type_id}">[[${a.type_name}]]</option>
						</select>
					</div>
					<input type= "hidden" name= "pageNum" value= "${all.pageNum}" id= "pageNum">>
					<button type="button" onclick="schArticle(1)" class="btn btn-primary">搜索</button>
				</form>

			</div>
			<div class="myPost_Theme" style="height: 80vh;margin-top: 50px;">
				<table width="100%" border="0" cellspacing="0" cellpadding="0" class="myPost_Table">
					<tr class="myPost_Th">
						<th><input type="checkbox" id="checkAll"></th>
						<th>文章标题</th>
						<th>文章类别</th>
						<th>发布讲师</th>
						<th>发布时间</th>
						<th>收藏人数</th>
						<th>阅读数量</th>
						<th>阅读状态</th>
					</tr>
					<tr th:each="t,iter:${all.list}">
						<td><input type="checkbox" id="box_${iter.count}" th:value="${t.article_id}"/></td>
						<td>
							<a style="color: red;" th:href="@{toToefl_detail(article_id=${t.article_id})}">[[${t.title}]]</a>
						</td>
						<td>
							[[${t.articleType.type_name}]]
						</td>
						<td>[[${t.teacher.user_name}]]</td>
						<td>[[${#dates.format(t.last_modify,'yyyy-MM-dd HH:mm')}]]</td>
						<td>[[${t.collect_num}]]</td>
						<td>[[${t.read_num}]]</td>
						<td th:if="${t.status} == '0'">正常阅读</td>
						<td th:if="${t.status} == '1'">禁止阅读</td>
					</tr>
				</table>

				<div class="pageList" style="width: 500px;float: right;">
						<ul th:if="${all.pages != 0}">
						<li th:if="${all.pageNum != 1}">
						<a href="###" th:onclick="schArticle(1)">首页</a></li>
						<li th:each="pages:${all.navigatepageNums}"><a href="###"
						th:onclick="schArticle([[${pages}]])"	th:class="${pages == all.pageNum} ? nowPage : ''">【[[${pages}]]】</a></li>
						<li th:if="${all.pageNum != all.pages}"><a href="###"
							th:onclick="schArticle([[${all.pages}]])">最后一页</a></li>
						<li th:if="${all.pageNum != 1}">
						<a href="###" th:onclick="schArticle([[${all.prePage}]])" class="pret">上一页</a></li>
						<li th:if="${all.pageNum != all.pages}">
						<a href="###" th:onclick="schArticle([[${all.nextPage}]])" class="next">下一页</a></li>
					</ul>
				</div>

				<div id="" class="" style="margin-top: 40px;width: 400px; float: left;">
					<input id="ban" class="btn btn-success" type="button" value="禁读"/>
					<input id="unlash" class="btn btn-primary" type="button" value="解禁"/>
					<input id="delete" class="btn btn-danger" type="button" value="删除"/>
				</div>
			</div>

		</div>

		
	</body>

</html>